package io.youngledo.usb.exception;

/**
 * 错误类型枚举
 * 用于分类不同类型的存储错误
 */
public enum ErrorType {

    // 连接相关错误
    CONNECTION_FAILED("连接失败", true, true),
    AUTHENTICATION_FAILED("认证失败", true, false),
    NETWORK_ERROR("网络错误", true, true),

    // 存储桶相关错误
    BUCKET_NOT_FOUND("存储桶不存在", true, false),
    BUCKET_ACCESS_DENIED("存储桶访问被拒绝", true, false),
    BUCKET_ALREADY_EXISTS("存储桶已存在", true, false),

    // 对象相关错误
    OBJECT_NOT_FOUND("对象不存在", true, false),
    OBJECT_ACCESS_DENIED("对象访问被拒绝", true, false),
    OBJECT_TOO_LARGE("对象过大", true, false),

    // 文件系统相关错误
    FILE_NOT_FOUND("文件不存在", true, false),
    FILE_ACCESS_DENIED("文件访问被拒绝", true, false),
    DISK_SPACE_INSUFFICIENT("磁盘空间不足", true, false),

    // 配置相关错误
    INVALID_CONFIGURATION("配置无效", true, false),
    UNSUPPORTED_OPERATION("操作不支持", false, false),

    // 系统相关错误
    GENERAL("通用错误", false, false),
    INTERNAL_ERROR("内部错误", false, true),
    TIMEOUT("操作超时", true, true);

    private final String description;
    private final boolean recoverable;
    private final boolean retryable;

    ErrorType(String description, boolean recoverable, boolean retryable) {
        this.description = description;
        this.recoverable = recoverable;
        this.retryable = retryable;
    }

    public String getDescription() {
        return description;
    }

    public boolean isRecoverable() {
        return recoverable;
    }

    public boolean isRetryable() {
        return retryable;
    }
}